//Accepted
#include <cstdio>
#include <cstring>
int p, n, c, i, j, b[1000], sum;
bool a[1000];

int main(){
	//freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
	
	scanf("%d%d%d", &p, &n, &c);
	while(p+n+c){
		sum=0;
		for(i=0;i<p;++i)scanf("%d", &b[i]);
		for(j=1;j<n;++j){
			for(i=0;i<p;++i){
				scanf("%d", &a[i]);
				b[i]+=a[i];
				if(!a[i]){
					if(b[i]>=c)sum++;
					b[i]=0;
				}
			}
		}
		for(i=0;i<p;++i)if(b[i]>=c)sum++;
		
		printf("%d\n", sum);
		
		scanf("%d%d%d", &p, &n, &c);
	}
	return 0;
}
